package com.pagoda.nerp.webapi.controller;

import com.pagoda.nerp.web.entities.HRZGZD;
import com.pagoda.nerp.web.services.HRZGZDService;
import com.pagoda.nerp.webapi.hander.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @Author:HXB
 * @Description  人员信息接口
 * @Date Create in 16:49 2017/12/27
 * @Modified By
 **/

@RestController
public class HRZGZDController {
    @Autowired
    private HRZGZDService hrzgzdService;

    @GetMapping("/getHRInfo")
    public ResponseResult getHRZGZDInfo(@RequestParam(value = "page",defaultValue = "0") int page,
                                        @RequestParam(value = "pagesize",defaultValue = "50") int pagesize,
                                        @RequestParam(value = "unitid",required = false, defaultValue = "") String UnitID,
                                        @RequestParam(value = "postid",required = false, defaultValue = "") String PostID,
                                        @RequestParam(value = "name",required = false, defaultValue = "") String name,
                                        @RequestParam(value = "code",required = false, defaultValue = "") String code,
                                        @RequestParam(value = "mobile",required = false, defaultValue = "") String mobile){
        Page<HRZGZD> list = hrzgzdService.getHRZGZDInfo(page,pagesize,UnitID,PostID,name,code,mobile);
        return ResponseResult.success(list);
    }

    @GetMapping("/updatehrzgzd")
    public ResponseResult updateHRZGZD(){
        List<HRZGZD> list = hrzgzdService.updateDBEmployee();
        return ResponseResult.success(list);
    }

//    @GetMapping("/testHRZGZD")
//    public ResponseResult TEST(){
//        Set<String> depts=new HashSet<>();
//        depts.add("80756010409");
//        depts.add("80757010078");
//        Set<String> jobtitlecodes=null;
//        String name=null;
//        String code="20180130037";
//        String mobile=null;
////        Page<HRZGZD> list = hrzgzdService.getHRZGZDInfo(0,50,"","","","","");
//        Page<HRZGZD> list = hrzgzdService.test(depts,jobtitlecodes,name,code,mobile);
//        System.out.println(ResponseResult.success(list));
//        return ResponseResult.success(list);
//    }
}
